package com.weizai.carshop.controller;


import cn.hutool.core.bean.BeanUtil;
import com.weizai.carshop.common.enumeration.AppHttpCodeEnum;
import com.weizai.carshop.common.result.ResponseResult;
import com.weizai.carshop.model.dto.CartListDto;
import com.weizai.carshop.model.dto.OrderDto;
import com.weizai.carshop.model.entiity.CartListEntity;
import com.weizai.carshop.model.vo.OrderInfoVo;
import com.weizai.carshop.service.OrderService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;


@RestController
@RequestMapping("/user/order")
@RequiredArgsConstructor
public class OrderController {

    private final OrderService orderService;


    /*
     * 新增订单
     * */
    @PostMapping
    public ResponseResult createOrder(@RequestBody OrderDto orderInfo) {

        OrderInfoVo info = orderService.createOrder(orderInfo);
        return ResponseResult.okResult(info);
    }
}
